ShaderVariablesLayout

This class is meant to be created together with the Shaders.

Those are meant to wrap the cbuffer from Direct3D and Uniform Block from OpenGL.

By wrapping the uniforms/cbuffers layouts, it is much easier to send those variables from any API.

Constructors

this
this(string layoutName, ShaderTypes t, uint hint, ShaderVar*[] variables)

Use the layout name for mentioning the uniform/cbuffer block name.

Members

Functions

append
ShaderVariablesLayout append(string varName, ShaderVar* v)
Undocumented in source. Be warned that the author may not have intended to support it.
append
ShaderVariablesLayout append(string varName, T data)

Appends a new variable to this layout. Type is inferred.

appendBlackboxed
ShaderVariablesLayout appendBlackboxed(string varName, UniformType t, size_t length)

Appends a new variable to this layout. Type is inferred.

calcAlignment
void calcAlignment()

Calculates the shader variables alignment based on the packFunc passed at startup. Those functions are based on the shader vendor and version. Align should be called always when there is a change on the layout.

dispose
void dispose()
Undocumented in source. Be warned that the author may not have intended to support it.
getAdditionalData
const(void*) getAdditionalData()
Undocumented in source. Be warned that the author may not have intended to support it.
getBlockData
void* getBlockData()
Undocumented in source. Be warned that the author may not have intended to support it.
getLayoutSize
size_t getLayoutSize()
Undocumented in source. Be warned that the author may not have intended to support it.
getShader
Shader getShader()
Undocumented in source. Be warned that the author may not have intended to support it.
isUnused
bool isUnused(string varName)

For speed sake, it doesn't check whether it is valid. That means both a valid and invalid variable would return false (meaning used.)

lock
void lock(Shader owner)
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
auto opDispatch()
Undocumented in source. Be warned that the author may not have intended to support it.
setAdditionalData
void setAdditionalData(void* d, bool isAllocated)
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

from
ShaderVariablesLayout from()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

additionalData
void* additionalData;
Undocumented in source.
data
void* data;
Undocumented in source.
hint
int hint;

The hint are used for the Shader backend as a notifier

isAdditionalAllocated
bool isAdditionalAllocated;
Undocumented in source.
lastPosition
size_t lastPosition;
Undocumented in source.
name
string name;
Undocumented in source.
owner
Shader owner;
Undocumented in source.
shaderType
ShaderTypes shaderType;
Undocumented in source.
variables
ShaderVarLayout[string] variables;
Undocumented in source.

Meta